<template>
  <div ref="rootRef">
      <slot></slot>
  </div>
</template>

<script>
import useScroll from './user-scroll';
import { ref } from 'vue';
export default {
  name: 'scroll',
  props: {
    click: {
      type: Boolean,
      default: true
    },
    probeType: {
      type: Number,
      default: 0
    }
  },
  // 定义组件向外派发的自定义事件
  // 这里会向外部派发scroll事件
  emits: ['scroll'],
  setup(props, { emit }) {
    const rootRef = ref(null);
    // sroll为scroll组件实例, 返回并暴露scroll组件实例
    const scroll = useScroll(rootRef, props, emit);
    return {
      rootRef,
      scroll
    };
  }
};
</script>

<style>

</style>
